/*
 * GUIUtil.java
 */

package gui;

import java.awt.Component;
import java.awt.Font;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 * GUIUtil is a class that contains static methods
 * for the UrbanParks GUI.
 * 
 * @author Sean Brown
 * @version 1.0
 */
public final class GUIUtil {
	
	/**
	 * Private constructor prevents instantiation.
	 */
	private GUIUtil() {
		//prevents instantiation
	}
	
	/**
	 * Displays an error message to the user with the message
	 * passed. 
	 * 
	 * @param the_message The error message to display.
	 */
	public static void errorMessage(final JFrame the_frame, 
			final String the_message) {
		JOptionPane.showMessageDialog(the_frame, the_message,
				"Error", JOptionPane.ERROR_MESSAGE);
	}
	
	/**
	 * Returns a Font that is larger than the Font currently
	 * for the component passes.
	 * 
	 * @param the_c The component to read the current Font.
	 * @return A Font that matches that is 6 points larger.
	 */
	public static Font largerFont(final Component the_c) {
		return new Font(the_c.getFont().getFontName(), 
				the_c.getFont().getStyle(), the_c.getFont().getSize() + 6);
	}
	
	/**
	 * Returns a Font that is medium than the Font currently
	 * for the component passes.
	 * 
	 * @param the_c The component to read the current Font.
	 * @return A Font that matches that is -2 points larger.
	 */
	
	
	public static Font mediumFont(final Component the_c) {
		return new Font(the_c.getFont().getFontName(), 
				the_c.getFont().getStyle(), the_c.getFont().getSize() - 2);
	}
	
	/**
	 * Returns a Font that is smaller than the Font currently
	 * for the component passes.
	 * 
	 * @param the_c The component to read the current Font.
	 * @return A Font that matches that is 4 points smaller.
	 */
	public static Font smallerFont(final Component the_c) {
		return new Font(the_c.getFont().getFontName(), 
				the_c.getFont().getStyle(), the_c.getFont().getSize() - 4);
	}
}
